package cn.sirun.com.fca.personal.center.repo;

import com.tencent.cloud.iov.kernel.constant.ApiConst;
import com.tencent.cloud.iov.kernel.model.BaseResponse;
import com.tencent.cloud.iov.kernel.service.ServiceGenerator;


import cn.sirun.com.fca.personal.center.model.request.MessageRequest;
import cn.sirun.com.fca.personal.center.model.response.MessageResponse;
import io.reactivex.Observable;

/**
 * Created by xueqiaoming on 2018/11/29.
 */

public class MessageRepository {
    private static volatile MessageRepository sInstance;

    public static MessageRepository getInstance() {
        if (sInstance == null) {
            synchronized (MessageRepository.class) {
                if (sInstance == null) {
                    sInstance = new MessageRepository();
                }
            }
        }

        return sInstance;
    }

    private final MessageService mMessageService;

    private MessageRepository() {
        mMessageService = ServiceGenerator.createService(MessageService.class, ApiConst.getBaseUrl());
    }


    public Observable<BaseResponse<MessageResponse>> getMessageList(MessageRequest request) {
        return mMessageService.getMessageList(request);
    }

}
